<template>
  <el-card id="ectu" style=" height: 610px"> </el-card>
</template>
<script>
export default {
  mounted() {
    var chartDom = document.getElementById("ectu");
    var myChart = this.$echarts.init(chartDom);
    var option;

    setTimeout(function () {
      option = {
        legend: {},
        tooltip: {
          trigger: "axis",
          showContent: false,
        },
        dataset: {
          source: [
            ["date", "4.10", "4.20", "4.30", "5.10", "5.20"],
            ["成功", 12, 24, 33, 32, 40,],
            ["未执行", 11, 23, 20, 15, 19],
            ["失败", 32, 20, 20, 23, 26],
          ],
        },
        xAxis: { type: "category" },
        yAxis: { gridIndex: 0 },
        grid: { top: "55%" },
        series: [
          {
            type: "line",
            smooth: true,
            seriesLayoutBy: "row",
            emphasis: { focus: "series" },
          },
          {
            type: "line",
            smooth: true,
            seriesLayoutBy: "row",
            emphasis: { focus: "series" },
          },
          {
            type: "line",
            smooth: true,
            seriesLayoutBy: "row",
            emphasis: { focus: "series" },
          },
          {
            type: "pie",
            id: "pie",
            radius: "30%",
            center: ["50%", "25%"],
            emphasis: {
              focus: "self",
            },
            label: {
              formatter: "{b}: {@2012} ({d}%)",
            },
            encode: {
              itemName: "date",
              value: "4.10",
              tooltip: "4.10",
            },
          },
        ],
      };
      myChart.on("updateAxisPointer", function (event) {
        const xAxisInfo = event.axesInfo[0];
        if (xAxisInfo) {
          const dimension = xAxisInfo.value + 1;
          myChart.setOption({
            series: {
              id: "pie",
              label: {
                formatter: "{b}: {@[" + dimension + "]} ({d}%)",
              },
              encode: {
                value: dimension,
                tooltip: dimension,
              },
            },
          });
        }
      });
      myChart.setOption(option);
    });
    option && myChart.setOption(option);
  },
};
</script>
<style>
</style>
